/*
 * dvbt.h - DVB-t interface
 *
 * Copyright (C) 2010-2011 Serge Begger
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef DVBT_H
#define DVBT_H

#include <QWidget>
#include <QSettings>
#include <QProcess>
#include <QFile>
#include <QtSql>

#include "gstengine.h"
#include "qcarpcdialog.h"

namespace Ui {
    class dvbt;
}

class dvbt : public QWidget
{
    Q_OBJECT

public:
    explicit dvbt(QWidget *parent = 0);
    ~dvbt();
    bool init();
    gstengine *gstEngine;
    int currVolume;
    void setVolume(int);

private:

    Ui::dvbt *ui;
    bool initVideo();
    int currCh;
    QString typeCh;

    void changeChannel();

    bool initDbConnection();
    QSqlDatabase db;
    QSqlRelationalTableModel *modelChannels;

    QSettings *settings;
    QProcess *scanProc;
    myProgressbar *progressbar;

    QString getMapValue(QMap<QString,QString> *map, int);
    QString getDbValue(int);
    void initEnums();
    QMap<QString,QString> *inversion;
    QMap<QString,QString> *bandwidth;
    QMap<QString,QString> *code_rate;
    QMap<QString,QString> *modulation;
    QMap<QString,QString> *trans_mode;
    QMap<QString,QString> *guard;
    QMap<QString,QString> *hierarchy;

signals:
    void hideWidget();

private slots:
    void on_backButton_pressed();
    void on_closeButton_pressed();
    void on_findButton_pressed();
    void on_prevButton_pressed();
    void on_nextButton_pressed();
    void on_chButton_pressed();
    void on_channelTableView_pressed(QModelIndex);
    void on_pushButUp_pressed();
    void on_pushButDw_pressed();
    void parceScan();
    void endScan(int);
    void toFullScreen();
};

#endif // DVBT_H
